﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxGridView;

namespace SGDemo.Web.OA
{
    public partial class CustomerItem : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            ASPxGridView gvw = pcCustomerRelatedView.FindControl("gvwAddressList") as ASPxGridView;
            gvw.DataSource = GetDS();
            gvw.DataBind();

        }

        private List<AddressDetails> GetDS()
        {
            List<AddressDetails> list = new List<AddressDetails>();
            list.Add(new AddressDetails("a001", "福建厦门集美同集路888号", "张三", "13616001111"));
            list.Add(new AddressDetails("a002", "福建厦门同安人民路123号", "李四", "13516331234"));
            list.Add(new AddressDetails("a003", "福建厦门海城同济路852号", "王五", "13688997894"));
            list.Add(new AddressDetails("a004", "福建厦门湖里嘉禾路745号", "赵六", "13816008529"));
            list.Add(new AddressDetails("a005", "福建厦门湖里嘉禾路222号", "孙七", "13816002222"));
            list.Add(new AddressDetails("a006", "福建厦门湖里嘉禾路333号", "周八", "13816003333"));
            list.Add(new AddressDetails("a007", "福建厦门湖里嘉禾路444号", "钱九", "13816004444"));
            list.Add(new AddressDetails("a008", "福建厦门湖里嘉禾路555号", "王十", "13816005555"));
            list.Add(new AddressDetails("a009", "福建厦门湖里嘉禾路666号", "李中华", "13816006666"));
            list.Add(new AddressDetails("a010", "福建厦门湖里嘉禾路777号", "谢强", "13816007443"));
            list.Add(new AddressDetails("a011", "福建厦门湖里嘉禾路888号", "谢强", "13816007773"));
            return list;
        }
        
        protected void gvwAddressList_DataBound(object sender, EventArgs e)
        {
            ASPxGridView gvw = sender as ASPxGridView;
            gvw.DataSource = GetDS();
            gvw.DataBind();
        }
    }

    public class AddressDetails
    {
        public AddressDetails(string keyid, string address, string contact, string mobilePhone)
        {
            this.Keyid = keyid;
            this.Address = address;
            this.Contact = contact;
            this.MobilePhone = mobilePhone;
        }

        private string _Keyid;
        
        public string Keyid
        {
            get { return _Keyid; }
            set { _Keyid = value; }
        }

        private string _Address;
        
        public string Address
        {
            get { return _Address; }
            set { _Address = value; }
        }

        private string _Contact;
        
        public string Contact
        {
            get { return _Contact; }
            set { _Contact = value; }
        }

        private string _MobilePhone;
        
        public string MobilePhone
        {
            get { return _MobilePhone; }
            set { _MobilePhone = value; }
        }

        private string _Remark;
        
        public string Remark
        {
            get { return _Remark; }
            set { _Remark = value; }
        }

        private string _CustomerKeyid;
        
        public string CustomerKeyid
        {
            get { return _CustomerKeyid; }
            set { _CustomerKeyid = value; }
        }
    }
}